# 使用alpine精简版nginx镜像
FROM nginx:1.23.4-alpine

# 设置维护者标签
LABEL maintainer="wiztop" version="v2.2.14-beta3"

# 设置时区为上海
RUN apk add --no-cache tzdata && \
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    echo "Asia/Shanghai" > /etc/timezone && \
    apk del tzdata

# 创建必要的目录结构
RUN mkdir -p /usr/local/xcsys/svc/dist && \
    mkdir -p /usr/local/xcsys/svc/conf

# 复制前端构建文件和nginx配置
COPY dist/ /usr/local/xcsys/svc/dist/
COPY nginx.conf /etc/nginx/nginx.conf

# 设置权限
RUN chown -R nginx:nginx /usr/local/xcsys/svc/dist && \
    chmod -R 755 /usr/local/xcsys/svc/dist

# 暴露80端口
EXPOSE 80

# 启动nginx并保持前台运行
CMD ["nginx", "-g", "daemon off;"]
